<template>
    <el-drawer
        :size="props.size"
        class="add-drawer"
        :model-value="props.show"
        :title="props.title"
        :close-on-click-modal="false"
        @close="props.close"
    >
        <template #header>
            <h1>{{ props.title }}</h1>
        </template>
        <el-form label-width="80px" label-position="top">
            <slot name="body"></slot>
        </el-form>
        <template #footer>
            <el-divider />
            <div class="footer">
                <slot name="footer"></slot>
            </div>
        </template>
    </el-drawer>
</template>

<script setup>
import { ref } from "vue";

const props = defineProps({
    size: {
        type: Number,
        default: 400
    },
    show: {
        type: Boolean,
        default: false,
        required: true
    },
    title: {
        type: String,
        default: "新增",
        required: true
    },
    close: {
        type: Function,
        required: true
    }
});
</script>

<style lang="scss">
.add-drawer {
    h1 {
        font-weight: bold;
        align-items: center;
    }
    .footer {
        display: flex;
        padding-bottom: 3em;
        justify-content: center;
        .el-button {
            padding: 20px 50px;
        }
    }
}
</style>
